import Vue from 'vue'
import Router from 'vue-router'
//导入组件
import Home from '@/pages/home/Home'
import Type from '@/pages/type/Type'
import ShopCar from '@/pages/shopcar/ShopCar'
import User from '@/pages/user/User'
import Pro_details from  "@/pages/pro_details/Pro_details"
import Pro_list from "@/pages/pro_list/Pro_list"
import Search from '@/pages/search/Search'
import Confirm from "@/pages/confirm/Confirm"
Vue.use(Router)

export default new Router({
//	创建路由
  routes: [
  	{
//		重定向为主页
  		path:'/',
  		redirect:"/Home"
  	},
//	路由
    {
      path: '/Home',
      name: 'Home',
      component: Home
    },
    {
      path: '/Type',
      name: 'Type',
      component: Type
    },
    {
      path: '/ShopCar',
      name: 'ShopCar',
      component: ShopCar
    },
    {
      path: '/User',
      name: 'User',
      component: User
    },
    {
      path: '/Pro_details',
      name: 'Pro_details',
      component: Pro_details
    },
    {
    	path:'/Search',
    	name:'Search',
    	component:Search
    },
    {
      path: '/Pro_list',
      name: 'Pro_list',
      component: Pro_list
    },
    {
      path: '/Confirm',
      name: 'Confirm',
      component: Confirm
    }
  ],
  scrollBehavior (to, from, savedPosition) {
	  if (savedPosition) {
	    return savedPosition
	  } else {
	    return { x: 0, y: 0 }
	  }
	}
})
